﻿using System;
using Besture.Bll.UserBase;
using Besture.UI.Common;

namespace Besture.UI.Control
{
    public partial class UserNav : System.Web.UI.UserControl 
    {
        public string SNightName = string.Empty;
        public int NightNumber = 0;
        public string SImageName = string.Empty;
        public string SNickName = string.Empty;
        public string[] Selected = new string[5];
        protected void Page_Load(object sender, EventArgs e)
        {
            GetNickName();
        }

        private void GetNickName()
        {

            SImageName = !string.IsNullOrEmpty(UserPage.GetUserLoginModel().UserImage) ? "/Upload/Image/Content/"+UserPage.GetUserLoginModel().UserImage : "/Resource/images/headimg.png";
            SNickName = UserPage.GetUserLoginModel().NickName;

            var liveRecordModel = new LiveRecordDac().GetModelByUserId(UserPage.GetUserLoginModel().ID);
            if (liveRecordModel == null) return;
            if (liveRecordModel.NightNumber >= 100)
                SNightName = "金牌会员";//金牌会员
            else if (liveRecordModel.NightNumber >= 50 && liveRecordModel.NightNumber < 100)
                SNightName = "银牌会员";    // 银牌会员
            else
                SNightName = "普通会员"; //普通会员
            NightNumber = liveRecordModel.NightNumber;
        }
    }
}